import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		hasLogin: false,
		userdata: [],
	},
	mutations: {
		login(state, data) {
			state.hasLogin = true;
			state.userdata = data;
		},
		logout(state) {
			state.hasLogin = false;
			state.userdata = [];
		}
	},
	getters: {
		isLoggedIn: state => {
			return state.hasLogin;
		}
	}
});

export default store